import store from '../../store'

export default function  $http(options) {
	const {
		url, 
		data
	} = options
	
	const dataObj = {
		userId: '5f354465ad57420001c700e6',
		...data
	}
	return new Promise((resolve, reject) => {
			 uniCloud.callFunction({
			 	name: url,
				data: dataObj
			 }).then((res) => {
				 const {result} = res
				 // console.log(result)
				 if(result.code === 200){
					 resolve(result)
				 } else {
					 reject(result)
				 }
			 }).catch((err) => {
				 reject(err)
			 })
	})
}